package com.txts.road.app.event.controller;

import com.txts.road.app.event.model.vo.EventAnnouncementVO;
import com.txts.road.app.event.service.EventAnnouncementService;
import com.txts.base.common.domain.ResponseDTO;
import io.swagger.v3.oas.annotations.Operation;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.web.bind.annotation.*;

import java.util.List;


/**
 * 赛事公告前端控制层
 *
 * @author baoyr
 * @since 2025-07-17 10:47
 */
@Tag(name = "赛事公告接口")
@RestController
@RequestMapping("/api/v1/event-announcement")
@RequiredArgsConstructor
public class EventAnnouncementController {
    private final EventAnnouncementService eventAnnouncementService;

    /**
     * 获取赛事公告列表
     */
    @Operation(summary = "获取赛事公告列表")
    @GetMapping("/{eventId}/announcements")
    public ResponseDTO<List<EventAnnouncementVO>> getEventAnnouncements(@PathVariable Long eventId) {
        return ResponseDTO.ok(eventAnnouncementService.getEventAnnouncements(eventId));
    }

    /**
     * 获取公告详情
     */
    @Operation(summary = "获取公告详情")
    @GetMapping("/announcement/{announcementId}")
    public ResponseDTO<EventAnnouncementVO> getAnnouncementDetail(@PathVariable Long announcementId) {
        return ResponseDTO.ok(eventAnnouncementService.getAnnouncementDetail(announcementId));

    }

}
